import asyncio
import time
from typing import Dict, Any, Optional, List, Callable, Tuple
from enum import Enum
from dataclasses import dataclass
import heapq
from collections import deque
from loguru import logger

from utils.logger import Logger
from app.core.resource_monitor import get_resource_monitor, ResourceMonitor
from middleware.retry_utils import task_scheduler, RetryConfig


class TaskPriority(Enum):
    